package com.heima.admin.job;

import com.heima.admin.service.WemediaNewsAutoScanService;
import com.heima.apis.wemedia.IWemediaClient;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 胡慧
 * @title: WeMediaNewsAutoScanJob
 * @projectName heima-leadnews
 * @description: 定时发布文章
 * @date 2021/3/118:24
 */

@Component
@Slf4j
public class WeMediaNewsAutoScanJob {
    @Autowired
    private WemediaNewsAutoScanService wemediaNewsAutoScanService;

    @Autowired
    private IWemediaClient wemediaClient;

    @XxlJob("wemediaAutoScanJob")
    public ReturnT<String>autoScanJob(String param)throws Exception{
        log.info("自媒体文章审核调度任务开始执行....");
        List<Integer> release = wemediaClient.findRelease();
        for (Integer id : release) {
            wemediaNewsAutoScanService.autoScanByMediaNewsId(id);
        }
        log.info("自媒体文章审核调度任务执行结束....");
        return ReturnT.SUCCESS;
    }

}
